T1306840 - DataGrid - TagBox in the filter row doesn't show selected tags if values are numbers#33080
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a DataGrid FilterRow scenario where a dxTagBox editor does not render selected tags when the underlying lookup values are numeric, by ensuring array filter values aren’t incorrectly discarded for number columns. Adds an integration test and supporting test models to cover the regression.
Changes:
- Adjust FilterRow editor value resolution to allow array
filterValuefor non-betweenoperations (enables TagBox multi-select values for numeric lookup columns). - Add a Jest integration test reproducing T1306840.
- Extend grid test models to access the filter row/cell and introduce a TagBox testing model.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/devextreme/js/__internal/ui/tests/mock/model/tag_box.ts | Adds a TagBox test model to set/get value and inspect rendered tags. |
| packages/devextreme/js/__internal/grids/grid_core/filter/m_filter_row.ts | Fixes getFilterValue to stop nulling array values for numeric columns outside between. |
| packages/devextreme/js/__internal/grids/grid_core/filter/tests/m_filter_row.integration.test.ts | Adds regression coverage for TagBox in FilterRow with numeric lookup values. |
| packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/row/group_row.ts | Refactors to reuse BaseRowModel. |
| packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/row/filter_row.ts | Adds FilterRow model for accessing filter cells. |
| packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/row/data_row.ts | Refactors to reuse BaseRowModel. |
| packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/row/base_row.ts | Introduces shared row model utilities (element/cell access). |
| packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/grid_core.ts | Adds getFilterRow() to the grid test model. |
| packages/devextreme/js/__internal/grids/grid_core/tests/mock/model/cell/filter_cell.ts | Adds FilterCell model to access editor widgets from filter cells. |
packages/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/model/grid_core.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/model/row/base_row.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/model/cell/filter_cell.ts
Show resolved
Hide resolved
packages/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/model/row/base_row.ts
Show resolved
Hide resolved
| return false; | ||
| const hasMultiselectEditor = function ($editorContainer): boolean { | ||
| const editor = getEditorInstance($editorContainer); | ||
| // @ts-expect-error |
There was a problem hiding this comment.
change import Editor to import Editor from '@ts/ui/editor/editor';
internal types contain NAME property, and it would be possible to remove @ts-expect-error
| return !editor || MULTISELECT_EDITOR_NAMES.includes(editor.NAME); | ||
| }; | ||
|
|
||
| const isValidFilterValue = function (filterValue, column, $editorContainer): boolean { |
There was a problem hiding this comment.
add types to arguments, please
…T1306840-26_1 # Conflicts: # packages/devextreme/js/__internal/grids/grid_core/__tests__/__mock__/model/grid_core.ts
| return this.root?.querySelectorAll('td') as NodeListOf<HTMLElement>; | ||
| } | ||
|
|
||
| public getCell(columnIndex: number): HTMLElement | null { | ||
| return this.getCells()?.[columnIndex] ?? null; |
There was a problem hiding this comment.
getCells() is typed to always return NodeListOf<HTMLElement>, but it can return undefined at runtime when root is null (because of optional chaining + type cast). This makes the public API of the mock model unsound and can cause runtime errors if a test calls getCells().length/iterates without null checks. Consider either (a) making getCells() return NodeListOf<HTMLElement> | undefined/null, or (b) returning an actual NodeList/empty collection and removing the cast/optional chaining (fail fast like GroupRowModel.getCells() does).
| return this.root?.querySelectorAll('td') as NodeListOf<HTMLElement>; | |
| } | |
| public getCell(columnIndex: number): HTMLElement | null { | |
| return this.getCells()?.[columnIndex] ?? null; | |
| if (this.root === null) { | |
| return document.createElement('tr').querySelectorAll<HTMLElement>('td'); | |
| } | |
| return this.root.querySelectorAll<HTMLElement>('td'); | |
| } | |
| public getCell(columnIndex: number): HTMLElement | null { | |
| return this.getCells()[columnIndex] ?? null; |
…tags if values are numbers (DevExpress#33080)
No description provided.